package org.amf.message;

import org.amf.gui.LoginJPanel;
import org.amf.helper.NicInspector;
import org.amf.helper.OsInspector;

/**
 * Classe che gestisce il message
 *
 * @author Federico Casani
 */
public class RequestManager {

    private byte[] message;

    public RequestManager(LoginJPanel loginJPanel, NicInspector nicInspector, OsInspector osInspector) {

        try {

            // JAXB e' la soluzione migliore ma si vuole evitare
            // di appesantire il jar poiche' l'output e' una
            // semplice stringa
            String messageString =
                    "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
                    "<amf xmlns=\"http://org.amf/schema\">" +
                    "<idApplication>" + "TC" + "</idApplication>" +
                    "<username>" + loginJPanel.getUsernameTextFieldText() + "</username>" +
                    "<password>" + loginJPanel.getPasswordPasswordFieldText() + "</password>" +
                    "<identifier>" +
                    "<macAddress>" + nicInspector.getMACaddress() + "</macAddress>" +
                    "<ipv4Address>" + nicInspector.getIPv4address() + "</ipv4Address>" +
                    "<osName>" + osInspector.getOsName() + "</osName>" +
                    "</identifier>" +
                    "</amf>";

            this.setMessage(messageString.getBytes("UTF-8"));

        } catch (Exception e) {
        }




    }

    public byte[] getMessage() {
        return message;
    }

    private void setMessage(byte[] message) {
        this.message = message;
    }





}
